import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MainVO, MainForm, MainQuery } from '@/api/system/main/types';

/**
 * 查询理赔主列表
 * @param query
 * @returns {*}
 */

export const listMain = (query?: MainQuery): AxiosPromise<MainVO[]> => {
  return request({
    url: '/sz/main/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询理赔主详细
 * @param id
 */
export const getMain = (id: string | number): AxiosPromise<MainVO> => {
  return request({
    url: '/sz/main/' + id,
    method: 'get'
  });
};

/**
 * 新增理赔主
 * @param data
 */
export const addMain = (data: MainForm) => {
  return request({
    url: '/sz/main',
    method: 'post',
    data: data
  });
};

/**
 * 修改理赔主
 * @param data
 */
export const updateMain = (data: MainForm) => {
  return request({
    url: '/sz/main',
    method: 'put',
    data: data
  });
};

/**
 * 删除理赔主
 * @param id
 */
export const delMain = (id: string | number | Array<string | number>) => {
  return request({
    url: '/sz/main/' + id,
    method: 'delete'
  });
};
